const baseUrl = 'http://enet.10000.gd.cn:10001'
const request = (url, data) => {
	return new Promise((resolve, reject) => {
		uni.request({
			method: "POST",
			url: baseUrl + url,
			data: data,
			header: {
				'content-type': 'application/json'
			},
			dataType: 'json',
		}).then((response) => {
			setTimeout(function() {
				uni.hideLoading();
			}, 1000);
			let [error, res] = response;
			resolve(res.data);
		}).catch(error => {
			uni.showToast({
				title: '登陆失败',
				icon:'none',
				duration: 2000
			});
			let [err, res] = error;
			reject(err)
		})
	});
}
export default request
